package com.hnucm.c202001020214;

import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.gyf.immersionbar.ImmersionBar;
import com.hnucm.c202001020214.object.Ex_msg;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

public class Account extends BaseActivity {
    ImageView imageView2;
    ConstraintLayout con01,constraintLayout9;
    TextView textView7,textView9,textView12;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_account);



        ImmersionBar.with(this)
                // .statusBarColor(R.color.touMing)
                .init();
        EventBus.getDefault().register(this);  //注册eventbus,

        imageView2 = findViewById(R.id.imageView2);
        textView7 = findViewById(R.id.textView7);
        textView9 = findViewById(R.id.textView9);
        textView12 = findViewById(R.id.textView12);
        imageView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                finish();
            }
        });

        con01 = findViewById(R.id.con01);
        con01.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                //退出登录
                ActivityCollector.finishAll();
                Intent intent = new Intent(Account.this,Login.class);
                startActivity(intent);
            }
        });

        constraintLayout9 = findViewById(R.id.constraintLayout9);
        constraintLayout9.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(Account.this,Exchange_Information.class);
                startActivity(intent);
            }
        });

    }

    //定义一个方法接收eventbus发出的消息
    @Subscribe(threadMode = ThreadMode.MAIN,priority = 100)//指定线程
    public void messge(Ex_msg e){


         textView7.setText(e.account);
         textView9.setText(e.phone);
        textView12.setText(e.no);

    }

}
